{extend name="public:layout" /}

{block name="title"}
	<title>{:site('siteName')}-设置支付密码</title>
{/block}

{block name="css"}
	<link rel="stylesheet" type="text/css" href="__STATIC__/{$theme}/css/user.css">
{/block}

{block name="content"}
	<div class="layui-main">
		<div class="user-main">
			<div class="user-left">
				{include file="public:user" index="0" /}
			</div>
			<div class="user-right">
				<div class="layui-tab layui-tab-brief">
					<ul class="layui-tab-title">
						<li class="layui-this">设置支付密码</li>
					</ul>
					<div class="layui-tab-content">
						<form class="layui-form user-data" action="">

							<div class="layui-form-item">
							    <label class="layui-form-label">登录密码</label>
							    <div class="layui-input-inline">
							    	<input type="password" name="password" value="" lay-verify="required|password" class="layui-input">
							    </div>
							    <div class="layui-form-mid layui-word-aux">验证登录密码</div>
							</div>

							<div class="layui-form-item">
							    <label class="layui-form-label">原支付密码</label>
							    <div class="layui-input-inline">
							    	<input type="password" name="password1" value="" class="layui-input">
							    </div>
							    <div class="layui-form-mid layui-word-aux">首次设置支付密码无需填写</div>
							</div>

							<div class="layui-form-item">
							    <label class="layui-form-label">支付密码</label>
							    <div class="layui-input-inline">
							    	<input type="password" name="password2" value="" lay-verify="required" class="layui-input">
							    </div>
							    <div class="layui-form-mid layui-word-aux">设置支付密码</div>
							</div>

							<div class="layui-form-item">
							    <label class="layui-form-label">确认密码</label>
							    <div class="layui-input-inline">
							    	<input type="password" name="password3" value="" lay-verify="required|password3" class="layui-input">
							    </div>
							    <div class="layui-form-mid layui-word-aux">确认支付密码</div>
							</div>
							
							<div class="layui-form-item">
								<label class="layui-form-label"></label>
							    <div class="layui-input-inline">
							    	<input type="hidden" name="user_id" value="{$user_id}" />
							    	<input type="hidden" name="__token__" value="{$Request.token}" />
							    	<button class="layui-btn layui-btn-main" lay-submit>确定</button>
							    </div>
							</div>
						</form>
					</div>
				</div> 
			</div>
		</div>
	</div>
{/block}

{block name="script"}
	<script type="text/javascript">
		layui.use(['jquery','form','layer'], function(){
			
			var $ = layui.jquery;
			var form = layui.form();
			var layer = layui.layer;

			//表单验证
			form.verify({
				password: function(password){
			  		var password2 = $("input[name='password2']").val();
			  		if(password == password2){
				    	return '登录密码不能和支付密码一样';
				    }
			  	},
			  	password3: function(password3){
			  		var password2 = $("input[name='password2']").val();
			  		if(password2 != password3){
				    	return '确认支付密码和支付密码不一致';
				    }
			  	}
			}); 


		});
	</script>
{/block}